package com.myworkspace.standard.common.thread;

import java.util.concurrent.ArrayBlockingQueue;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit;

public class TestThreadPool {
    public static void main(String[] args) {
        try {
            testPool();
        }catch (Exception e){
            e.printStackTrace();
        }

    }

    public static void testPool (){
        ThreadPoolExecutor executor= new ThreadPoolExecutor(3, 10, 10, TimeUnit.SECONDS, new ArrayBlockingQueue<>(4));
        for (int i = 0; i < 14; i++) {
            int k = i;
            executor.execute(() -> System.out.println("线程"+k+"。。。。。。"));
        }

    }
}
